fix: read the valign of a credit-image - #457
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human Summary
Seems plausible that this is the correct way to read valign. This one was both found and fixed by AI.
Summary
Reading a
<credit-image>threw itsvalignattribute away, so a credit-image alignment did notsurvive a round trip.
getImageDatainsrc/private/mx/impl/PageTextFunctions.cppdiscarded it onpurpose, because the generic
getPositionDatacannot read a picture's alignment: a picture usesvalign-image(top, middle, bottom, no baseline) rather than thevaligna text element uses, andthe generic value getter is compiled out on the type mismatch, so a present attribute came back as
the default
baseline.The read now happens off the element, in one helper shared with the direction
<image>reader:getImageValigninsrc/private/mx/impl/PositionFunctions.h, next to the writer'ssetImageValignFromVerticalAlignment, called from both readers so they cannot drift.DirectionReader::parseImageloses its own inline switch, and theValignImage.hinclude it nolonger needs. An absent attribute still reads as unspecified, and this reader never produces
baseline. The writer is unchanged. The comment in
PageImageData.hthat said vertical alignment wasnot modeled is corrected.
Testing
creditRoundTrip.imageValignSurvivesfails before the fix (top, middle and bottom all read back unspecified) and passes aftercreditRoundTrip.imageValignIsReadFromXmlreads a spelled-outvalign="middle"; fails before, passes aftercreditRoundTrip.imageValignAbsentStaysUnspecifiedmake api-testpasses (5891 assertions in 660 test cases)make api-roundtrippasses with the newly pinnedsynthetic/credit-image.3.0.xml(415 of 415 pinned)make api-roundtrip-discover: 415 pass, 425 fail; before the fix 414 pass, 426 fail, credit-image.3.0.xml being the file the fix unlockedmake test-allpasses (core round trip, core unit, api-test, api-roundtrip)make fmtandmake fmt-checkReferences
<image>and<credit-image>writevalign="top"for other alignments #444, the writer side, merged as fix: write the right valign-image for images #451